Skip to main content

Tutorials

Quickstart​

Prerequisites​

  • Python 3.13+
  • Docker (for local Qdrant)
  • A valid ICICLE AI Tapis access token

Step 1: Start Qdrant​

docker run --name qdrant -p 6333:6333 -p 6334:6334 -d qdrant/qdrant

Step 2: Configure Environment​

cp .env.example .env
VariableRequiredDescription
QDRANT_URLyesQdrant server URL (append :443 if behind HTTPS proxy)
QDRANT_API_KEYnoQdrant API key (if auth is enabled)
APP_ENVnodev or prod
TAPIS_ISSUERyesJWT issuer to validate (https://icicleai.tapis.io/v3/tokens)
TAPIS_JWKS_URLyesJWKS endpoint for token signature verification
TAPIS_TENANT_IDyesAllowed Tapis tenant (icicleai)
ALLOWED_ORIGINSnoJSON array of CORS origins. Defaults to ["*"] (allow all).
DROP_EMPTY_COLLECTIONSnotrue lets an emptied collection be dropped. Defaults to false; see How User Isolation Works.

Cross-encoder reranking (all optional — the service runs fine without them):

VariableDefaultDescription
RERANK_MODELBAAI/bge-reranker-baseModel used when a request does not name one
RERANK_ALLOWED_MODELS["BAAI/bge-reranker-base","cross-encoder/ms-marco-MiniLM-L-6-v2"]JSON array. A request may only select a model from this list
RERANK_PRELOADfalseLoad the default model at startup instead of on first use
RERANK_THREADS0Torch intra-op threads. Set this explicitly. 0 lets torch read nproc, which in a container reports the host's CPU count, not the cgroup quota — oversubscribing threads and causing heavy throttling. Match it to the pod's actual CPU limit.
RERANK_MAX_CANDIDATES128Hard cap on candidates scored per request
RERANK_MAX_LENGTH512Token truncation length for each (query, passage) pair

Step 3: Install and Run​

uv venv
source .venv/bin/activate
uv pip install -e .
uvicorn src.app.main:app --reload --host 0.0.0.0 --port 8000

Step 4: Verify​

curl http://localhost:8000/healthz
# {"status":"ok","version":"1.0.0","qdrant":"ok","cross_encoder":true}

cross_encoder reports whether cross-encoder reranking is available.

Step 5 (optional): Enable cross-encoder reranking​

Cross-encoder reranking needs PyTorch, which is not installed by default:

uv pip install -e ".[rerank]" --extra-index-url https://download.pytorch.org/whl/cpu

The CPU wheel index matters: the default PyPI torch wheel bundles roughly 2.5GB of CUDA libraries that are dead weight on a CPU-only deployment.